﻿using System.Windows;
using System.Windows.Input;

namespace SatelliteUI.Views
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        WindowState StartupWindowState = WindowState.Normal;

        private void Grid_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
                DragMove();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            SystemCommands.MinimizeWindow(this);
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (StartupWindowState == WindowState.Normal)
            {
                Caption.Margin = new Thickness(Caption.Margin.Left + 6, Caption.Margin.Top + 6, Caption.Margin.Right + 6, Caption.Margin.Bottom);
                Caption.Height += 7;
                Shadow.Margin = new Thickness(0, 0, 0, 0);
                SystemCommands.MaximizeWindow(this);
                StartupWindowState = WindowState.Maximized;
            }

            else
            {
                Caption.Margin = new Thickness(Caption.Margin.Left - 6, Caption.Margin.Top - 6, Caption.Margin.Right - 6, Caption.Margin.Bottom);
                Caption.Height -= 7;
                Shadow.Margin = new Thickness(28, 28, 28, 28);
                SystemCommands.RestoreWindow(this);
                StartupWindowState = WindowState.Normal;
            }
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            Close();
        }

        private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = false;
            e.Handled = true;
        }

        private void TextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
        {
            OutTextBox.ScrollToEnd();
        }


    }
}
